<script setup>
const props = defineProps({
  goodsItem: {
    type: Object,
    required: true,
    default: () => ({}),
  },
});
</script>

<template>
  <div class="goods-item">
    <img class="goods-img" :src="props.goodsItem.coverPic" alt="" />
    <h3 class="goods-name">{{ props.goodsItem.goodsName }}</h3>
    <p class="goods-class">{{ props.goodsItem.label }}</p>
    <div class="price">
      <span class="label">保证金</span>
      <span class="amount">¥{{ props.goodsItem.goodsAmount }}</span>
    </div>
  </div>
</template>

<style scoped lang="scss">
.goods-item {
  display: flex;
  flex-direction: column;
  width: 260px;
  box-shadow: 0px 0px 16px 0px rgba(11, 13, 18, 0.06);
  background: #ffffff;
  border-radius: 16px 16px 16px 16px;
  border: 1px solid rgba(25, 30, 40, 0.08);
  padding-bottom: 20px;
  margin-bottom: 20px;
}
.goods-img {
  border-radius: 16px;
  margin-bottom: 12px;
}
.goods-name {
  padding: 0 16px;
  // 超出两行显示省略号
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 15px;
  color: #191e28;
  line-height: 24px;
  margin-bottom: 12px;
}
.goods-class {
  color: rgba(25, 30, 40, 0.72);
  padding: 0 16px;
  margin-bottom: 10px;
}
.price {
  flex: 1;
  display: flex;
  padding: 0 16px;
  .label {
    font-size: 12px;
    color: #ff8c1d;
    padding: 2px 8px;
    background: rgba(255, 140, 29, 0.08);
    border-radius: 4px;
  }
  .amount {
    flex: 1;
    text-align: right;
    color: #ff4f4f;
    font-weight: bold;
  }
}
</style>